package com.rahwi.rahwi_server.vo.results;

/**
 * @ClassName ActionResult
 * @Description http返回对象
 * @Date 2021/12/9 12:24
 * @Autor mjw
 * @Version 1.0
 */
public class ActionResult {
    /**
     *
     */
    private boolean isSuccess;

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return Data;
    }

    public void setData(Object data) {
        Data = data;
    }

    private int code;

    private String msg;

    private Object Data;

    /**
     *
     * @param isSuccess
     * @param code
     * @param msg
     * @param data
     */
    private ActionResult(boolean isSuccess, int code, String msg, Object data){
        this.isSuccess = isSuccess;
        this.code = code;
        this.msg = msg;
        this.Data = data;
    }

    /**
     *
     * @param data
     * @return PostResult
     */
    public static ActionResult success(Object data){
        return new ActionResult(true,200,"success",data);
    }

    /**
     *
     * @param code
     * @param msg
     * @return PostResult
     */
    public static ActionResult fail(int code, String msg){
        return new ActionResult(false,code,msg,null);
    }
}
